//
//  MovieCollectionViewCell.m
//  UI_豆瓣扩展
//
//  Created by dllo on 15/11/8.
//  Copyright © 2015年 张磊. All rights reserved.
//

#import "MovieCollectionViewCell.h"

@implementation MovieCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubView];
    }
    return self;
}

- (void)createSubView
{
    self.headImageView = [[UIImageView alloc]initWithFrame:CGRectMake(20, 30, 90, 118)];
    [self.contentView addSubview:self.headImageView];
    self.headImageView.backgroundColor = [UIColor redColor];
    self.headImageView.userInteractionEnabled = YES;
    [_headImageView release];
    
    
    self.nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 150, 90, 20)];
    [self.contentView addSubview:self.nameLabel];
    self.nameLabel.backgroundColor = [UIColor orangeColor];
    [_nameLabel release];
}

-(void)setAMovie:(Movie *)aMovie
{
    if (_aMovie != aMovie) {
        [_aMovie release];
        _aMovie = [aMovie retain];
    }
    self.nameLabel.text = self.aMovie.movieName;
    
    NSURL *url = [NSURL URLWithString:self.aMovie.pic_url];
    [self.headImageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"picholder.png"]];
}






@end
